# --------------------------------------------------------
# Buiilding portfolio 
# --------------------------------------------------------
# Written: Gianrocco Mucedero 
# IUSS Pavia/EUCENTRE/
# Created: 7 10 2019
# Units MUST be in kN, m 

wipe;									# Command used to start over without having to exit and restart the interpreter
puts "Model Generation Started";			# Text seen on interpreter
set outsdir "Result"
file mkdir $outsdir
file mkdir $outsdir/props

# --------------------------------------
# LOAD SOME SCRIPTS
# --------------------------------------
source Units.tcl
source joint_behaviour.tcl
source infill.tcl
source rcBC_nonDuct.tcl

# DEFINE MODEL DIMENSIONS AND DOFS
# --------------------------------------
model basic -ndm 2 -ndf 3
# --------------------------------------
# DEFINE SOME VARIABLES
# --------------------------------------
set cv		[expr 20*$mm];			# Cover
set dbL		[expr 14*$mm];			# Long Bars
set dbV		[expr 8*$mm];			# Trans Bars
set fyL		350.00;
set fuL		[expr 1.4*$fyL];
set fyV		350.00;
set Es		200000.;
set fc		20.00;
set Ec		[expr 3320*sqrt($fc)+6900];
set conc 	[list $fc $Ec $cv];
set brs 	[list $dbL $dbV]; 			# bars		Bar dias (dbL dbV) m
set STb		1;
set STc		1;
set H       3.00; #[m]
set Lcamp1   4.00
set Lcamp2   4.00

node 11   0.00 0.00 -mass 0.0 0.0 0.0; 
node 12   4.00 0.00 -mass 0.0 0.0 0.0; 
node 13   8.00 0.00 -mass 0.0 0.0 0.0; 
node 14   12.00 0.00 -mass 0.0 0.0 0.0; 

fix 11 1  1  1   
fix 12 1  1  1 
fix 13 1  1  1  
fix 14 1  1  1  


set hb1 [expr 0.40*0.5]
set hc1 [expr 0.30*0.5]

geomTransf PDelta	1 -jntOffset 0.0 $hb1 0.0 -$hb1; # z is in -X
geomTransf Linear 	3 -jntOffset $hc1 0.0 -$hc1 0.0; # # z is in Y

set GTcol1 	1
set GTbmx1 	3




#Column 
set rho_shr1 		0.002234021
set rho_top1zz1 	0.003665191
set rho_mid1zz1 	0.00
set rho_bot1zz1 	0.003665191
set rho_top2zz1 	0.003665191
set rho_mid2zz1 	0.00
set rho_bot2zz1		0.003665191
set rho_top1yy1 	0.003665191
set rho_mid1yy1 	0.00
set rho_bot1yy1 	0.003665191
set rho_top2yy1 	0.003665191
set rho_mid2yy1 	0.00
set rho_bot2yy1		0.003665191
#Column 
set rho_shr12 		0.002234021
set rho_top1zz12 	0.004664789
set rho_mid1zz12 	0.00
set rho_bot1zz12 	0.004664789
set rho_top2zz12 	0.004664789
set rho_mid2zz12 	0.00
set rho_bot2zz12	0.004664789
set rho_top1yy12 	0.004664789
set rho_mid1yy12 	0.00
set rho_bot1yy12 	0.004664789
set rho_top2yy12 	0.004664789
set rho_mid2yy12 	0.00
set rho_bot2yy12	0.004664789
#Beam1
set rho_shr2 		0.002234021
set rho_top1zz2 	0.002700667
set rho_mid1zz2 	0.00
set rho_bot1zz2 	0.002700667
set rho_top2zz2 	0.005401335
set rho_mid2zz2 	0.00
set rho_bot2zz2		0.002700667
set rho_top1yy2 	0.002700667
set rho_mid1yy2 	0.00
set rho_bot1yy2 	0.002700667
set rho_top2yy2 	0.005401335
set rho_mid2yy2 	0.00
set rho_bot2yy2		0.002700667




#Beam2
set rho_shr3 		0.002234021
set rho_top1zz3 	0.002700667
set rho_mid1zz3 	0.00
set rho_bot1zz3 	0.002700667
set rho_top2zz3 	0.002700667
set rho_mid2zz3 	0.00
set rho_bot2zz3		0.002700667
set rho_top1yy3 	0.002700667
set rho_mid1yy3 	0.00
set rho_bot1yy3 	0.002700667
set rho_top2yy3 	0.002700667
set rho_mid2yy3 	0.00
set rho_bot2yy3		0.002700667
#Beam4

set rho_shr5 		0.002234021
set rho_top1zz5 	0.002700667
set rho_mid1zz5 	0.00
set rho_bot1zz5 	0.002700667
set rho_top2zz5	    0.004051001
set rho_mid2zz5 	0.00
set rho_bot2zz5		0.002700667
set rho_top1yy5	    0.002700667
set rho_mid1yy5 	0.00
set rho_bot1yy5 	0.002700667
set rho_top2yy5 	0.004051001
set rho_mid2yy5 	0.00
set rho_bot2yy5     0.002700667
#Beam6
set rho_shr7 		0.002234021
set rho_top1zz7 	0.004051001
set rho_mid1zz7 	0.00
set rho_bot1zz7 	0.002700667
set rho_top2zz7	    0.002700667
set rho_mid2zz7 	0.00
set rho_bot2zz7		0.002700667
set rho_top1yy7	    0.004051001
set rho_mid1yy7 	0.00
set rho_bot1yy7 	0.002700667
set rho_top2yy7 	0.002700667
set rho_mid2yy7 	0.00
set rho_bot2yy7     0.002700667
#Beam5
set rho_shr6 		0.002234021
set rho_top1zz6 	0.004051001
set rho_mid1zz6 	0.00
set rho_bot1zz6 	0.002700667
set rho_top2zz6	    0.004051001
set rho_mid2zz6 	0.00
set rho_bot2zz6		0.002700667
set rho_top1yy6 	0.004051001
set rho_mid1yy6 	0.00
set rho_bot1yy6 	0.002700667
set rho_top2yy6 	0.004051001
set rho_mid2yy6 	0.00
set rho_bot2yy6     0.002700667
set pflag2 1

set pfile_joint [open $outsdir/props/joint.txt w];
set pfile_columns [open $outsdir/props/columns.txt w];
set pfile_beam [open $outsdir/props/beams.txt w];



joint_behaviour 2 21 0.00  3.00 300 300 400 300 $fc $cv $dbL $dbV 257.55 $H $pfile_joint
joint_behaviour 1 22 4.00  3.00 350 300 400 300 $fc $cv $dbL $dbV 515.10 $H $pfile_joint
joint_behaviour 1 23 8.00  3.00 350 300 400 300 $fc $cv $dbL $dbV 515.10 $H $pfile_joint
joint_behaviour 2 24 12.00 3.00 300 300 400 300 $fc $cv $dbL $dbV 257.55 $H $pfile_joint

joint_behaviour 2 31 0.00  6.00 300 300 400 300 $fc $cv $dbL $dbV 202.10 $H $pfile_joint
joint_behaviour 1 32 4.00  6.00 300 300 400 300 $fc $cv $dbL $dbV 404.20 $H $pfile_joint
joint_behaviour 1 33 8.00  6.00 300 300 400 300 $fc $cv $dbL $dbV 404.20 $H $pfile_joint
joint_behaviour 2 34 12.00 6.00 300 300 400 300 $fc $cv $dbL $dbV 202.10 $H $pfile_joint

joint_behaviour 2 41 0.00  9.00 300 300 400 300 $fc $cv $dbL $dbV 146.65 $H $pfile_joint
joint_behaviour 1 42 4.00  9.00 300 300 400 300 $fc $cv $dbL $dbV 293.30 $H $pfile_joint
joint_behaviour 1 43 8.00  9.00 300 300 400 300 $fc $cv $dbL $dbV 293.30 $H $pfile_joint
joint_behaviour 2 44 12.00 9.00 300 300 400 300 $fc $cv $dbL $dbV 146.65 $H $pfile_joint

joint_behaviour 2 51 0.00  12.00 300 300 400 300 $fc $cv $dbL $dbV 91.20 $H $pfile_joint
joint_behaviour 1 52 4.00  12.00 300 300 400 300 $fc $cv $dbL $dbV 182.40 $H $pfile_joint
joint_behaviour 1 53 8.00  12.00 300 300 400 300 $fc $cv $dbL $dbV 182.40 $H $pfile_joint
joint_behaviour 2 54 12.00 12.00 300 300 400 300 $fc $cv $dbL $dbV 91.20 $H $pfile_joint

joint_behaviour 2 61 0.00  15.00 300 300 400 300 $fc $cv $dbL $dbV 35.75 $H $pfile_joint
joint_behaviour 1 62 4.00  15.00 300 300 400 300 $fc $cv $dbL $dbV 71.50 $H $pfile_joint
joint_behaviour 1 63 8.00  15.00 300 300 400 300 $fc $cv $dbL $dbV 71.50 $H $pfile_joint
joint_behaviour 2 64 12.00 15.00 300 300 400 300 $fc $cv $dbL $dbV 35.75 $H $pfile_joint


set pfile_infill [open $outsdir/props/infill.txt w];

infill 555 "single" [list 121 122 12 11] 4000 3000 300 300 400 300 0.00 0.00 $Ec 2 1 0 1 4 1 $pfile_infill ;
infill 556 "single" [list 122 123 13 12] 4000 3000 350 300 400 300 0.00 0.00 $Ec 2 1 0 1 4 1 $pfile_infill ;
infill 557 "single" [list 123 124 14 13] 4000 3000 350 300 400 300 0.00 0.00 $Ec 2 1 0 1 4 1 $pfile_infill ;

infill 565 "single" [list 131 132 122 121] 4000 3000 300 300 400 300 0.00 0.00 $Ec 2 1 0 1 4 1 $pfile_infill ;
infill 566 "single" [list 132 133 123 122] 4000 3000 300 300 400 300 0.00 0.00 $Ec 2 1 0 1 4 1 $pfile_infill ;
infill 567 "single" [list 133 134 124 123] 4000 3000 300 300 400 300 0.00 0.00 $Ec 2 1 0 1 4 1 $pfile_infill ;

infill 575 "single" [list 141 142 132 131] 4000 3000 300 300 400 300 0.00 0.00 $Ec 2 1 0 1 4 1 $pfile_infill ;
infill 576 "single" [list 142 143 133 132] 4000 3000 300 300 400 300 0.00 0.00 $Ec 2 1 0 1 4 1 $pfile_infill ;
infill 577 "single" [list 143 144 134 133] 4000 3000 300 300 400 300 0.00 0.00 $Ec 2 1 0 1 4 1 $pfile_infill ;

infill 585 "single" [list 151 152 142 141] 4000 3000 300 300 400 300 0.00 0.00 $Ec 2 1 0 1 4 1 $pfile_infill ;
infill 586 "single" [list 152 153 143 142] 4000 3000 300 300 400 300 0.00 0.00 $Ec 2 1 0 1 4 1 $pfile_infill ;
infill 587 "single" [list 153 154 144 143] 4000 3000 300 300 400 300 0.00 0.00 $Ec 2 1 0 1 4 1 $pfile_infill ;

infill 595 "single" [list 161 162 152 151] 4000 3000 300 300 400 300 0.00 0.00 $Ec 2 1 0 1 4 1 $pfile_infill ;
infill 596 "single" [list 162 163 153 152] 4000 3000 300 300 400 300 0.00 0.00 $Ec 2 1 0 1 4 1 $pfile_infill ;
infill 597 "single" [list 163 164 154 153] 4000 3000 300 300 400 300 0.00 0.00 $Ec 2 1 0 1 4 1 $pfile_infill ;
close $pfile_infill
#Column element
rcBC_nonDuct $STc 521 $GTcol1 11 121 $fyL $fyV $Es $fc $Ec 0.300 0.300 0.180  $cv  $dbL $dbV  257.55  [expr 0.5*$H]  $rho_shr1 $rho_top1zz1 $rho_mid1zz1 $rho_bot1zz1 $rho_top2zz1 $rho_mid2zz1 $rho_bot2zz1 $rho_top1yy1 $rho_mid1yy1 $rho_bot1yy1 $rho_top2yy1 $rho_mid2yy1 $rho_bot2yy1 $pfile_columns $pflag2; 
rcBC_nonDuct $STc 522 $GTcol1 12 122 $fyL $fyV $Es $fc $Ec 0.350 0.300 0.180  $cv  $dbL $dbV  515.10  [expr 0.5*$H]  $rho_shr12 $rho_top1zz12 $rho_mid1zz12 $rho_bot1zz12 $rho_top2zz12 $rho_mid2zz12 $rho_bot2zz12 $rho_top1yy12 $rho_mid1yy12 $rho_bot1yy12 $rho_top2yy12 $rho_mid2yy12 $rho_bot2yy12 $pfile_columns $pflag2; 
rcBC_nonDuct $STc 523 $GTcol1 13 123 $fyL $fyV $Es $fc $Ec 0.350 0.300 0.180  $cv  $dbL $dbV  515.10  [expr 0.5*$H]  $rho_shr12 $rho_top1zz12 $rho_mid1zz12 $rho_bot1zz12 $rho_top2zz12 $rho_mid2zz12 $rho_bot2zz12 $rho_top1yy12 $rho_mid1yy12 $rho_bot1yy12 $rho_top2yy12 $rho_mid2yy12 $rho_bot2yy12 $pfile_columns $pflag2;  
rcBC_nonDuct $STc 524 $GTcol1 14 124 $fyL $fyV $Es $fc $Ec 0.300 0.300 0.180  $cv  $dbL $dbV  257.55  [expr 0.5*$H]  $rho_shr1 $rho_top1zz1 $rho_mid1zz1 $rho_bot1zz1 $rho_top2zz1 $rho_mid2zz1 $rho_bot2zz1 $rho_top1yy1 $rho_mid1yy1 $rho_bot1yy1 $rho_top2yy1 $rho_mid2yy1 $rho_bot2yy1 $pfile_columns $pflag2; 

rcBC_nonDuct $STc 531 $GTcol1 121 131 $fyL $fyV $Es $fc $Ec 0.300 0.300 0.180  $cv  $dbL $dbV  202.10   [expr 0.5*$H]  $rho_shr1 $rho_top1zz1 $rho_mid1zz1 $rho_bot1zz1 $rho_top2zz1 $rho_mid2zz1 $rho_bot2zz1 $rho_top1yy1 $rho_mid1yy1 $rho_bot1yy1 $rho_top2yy1 $rho_mid2yy1 $rho_bot2yy1 $pfile_columns $pflag2; 
rcBC_nonDuct $STc 532 $GTcol1 122 132 $fyL $fyV $Es $fc $Ec 0.300 0.300 0.180  $cv  $dbL $dbV  404.20  [expr 0.5*$H]  $rho_shr1 $rho_top1zz1 $rho_mid1zz1 $rho_bot1zz1 $rho_top2zz1 $rho_mid2zz1 $rho_bot2zz1 $rho_top1yy1 $rho_mid1yy1 $rho_bot1yy1 $rho_top2yy1 $rho_mid2yy1 $rho_bot2yy1 $pfile_columns $pflag2; 
rcBC_nonDuct $STc 533 $GTcol1 123 133 $fyL $fyV $Es $fc $Ec 0.300 0.300 0.180  $cv  $dbL $dbV  404.20  [expr 0.5*$H]  $rho_shr1 $rho_top1zz1 $rho_mid1zz1 $rho_bot1zz1 $rho_top2zz1 $rho_mid2zz1 $rho_bot2zz1 $rho_top1yy1 $rho_mid1yy1 $rho_bot1yy1 $rho_top2yy1 $rho_mid2yy1 $rho_bot2yy1 $pfile_columns $pflag2; 
rcBC_nonDuct $STc 534 $GTcol1 124 134 $fyL $fyV $Es $fc $Ec 0.300 0.300 0.180  $cv  $dbL $dbV  202.10  [expr 0.5*$H]  $rho_shr1 $rho_top1zz1 $rho_mid1zz1 $rho_bot1zz1 $rho_top2zz1 $rho_mid2zz1 $rho_bot2zz1 $rho_top1yy1 $rho_mid1yy1 $rho_bot1yy1 $rho_top2yy1 $rho_mid2yy1 $rho_bot2yy1 $pfile_columns $pflag2; 

rcBC_nonDuct $STc 541 $GTcol1 131 141 $fyL $fyV $Es $fc $Ec 0.300 0.300 0.180  $cv  $dbL $dbV  146.65  [expr 0.5*$H]  $rho_shr1 $rho_top1zz1 $rho_mid1zz1 $rho_bot1zz1 $rho_top2zz1 $rho_mid2zz1 $rho_bot2zz1 $rho_top1yy1 $rho_mid1yy1 $rho_bot1yy1 $rho_top2yy1 $rho_mid2yy1 $rho_bot2yy1 $pfile_columns $pflag2; 
rcBC_nonDuct $STc 542 $GTcol1 132 142 $fyL $fyV $Es $fc $Ec 0.300 0.300 0.180  $cv  $dbL $dbV  293.30  [expr 0.5*$H]  $rho_shr1 $rho_top1zz1 $rho_mid1zz1 $rho_bot1zz1 $rho_top2zz1 $rho_mid2zz1 $rho_bot2zz1 $rho_top1yy1 $rho_mid1yy1 $rho_bot1yy1 $rho_top2yy1 $rho_mid2yy1 $rho_bot2yy1 $pfile_columns $pflag2; 
rcBC_nonDuct $STc 543 $GTcol1 133 143 $fyL $fyV $Es $fc $Ec 0.300 0.300 0.180  $cv  $dbL $dbV  293.30  [expr 0.5*$H]  $rho_shr1 $rho_top1zz1 $rho_mid1zz1 $rho_bot1zz1 $rho_top2zz1 $rho_mid2zz1 $rho_bot2zz1 $rho_top1yy1 $rho_mid1yy1 $rho_bot1yy1 $rho_top2yy1 $rho_mid2yy1 $rho_bot2yy1 $pfile_columns $pflag2; 
rcBC_nonDuct $STc 544 $GTcol1 134 144 $fyL $fyV $Es $fc $Ec 0.300 0.300 0.180  $cv  $dbL $dbV  146.65  [expr 0.5*$H]  $rho_shr1 $rho_top1zz1 $rho_mid1zz1 $rho_bot1zz1 $rho_top2zz1 $rho_mid2zz1 $rho_bot2zz1 $rho_top1yy1 $rho_mid1yy1 $rho_bot1yy1 $rho_top2yy1 $rho_mid2yy1 $rho_bot2yy1 $pfile_columns $pflag2; 

rcBC_nonDuct $STc 551 $GTcol1 141 151 $fyL $fyV $Es $fc $Ec 0.300 0.300 0.180  $cv  $dbL $dbV  91.20   [expr 0.5*$H]  $rho_shr1 $rho_top1zz1 $rho_mid1zz1 $rho_bot1zz1 $rho_top2zz1 $rho_mid2zz1 $rho_bot2zz1 $rho_top1yy1 $rho_mid1yy1 $rho_bot1yy1 $rho_top2yy1 $rho_mid2yy1 $rho_bot2yy1 $pfile_columns $pflag2; 
rcBC_nonDuct $STc 552 $GTcol1 142 152 $fyL $fyV $Es $fc $Ec 0.300 0.300 0.180  $cv  $dbL $dbV  182.4   [expr 0.5*$H]  $rho_shr1 $rho_top1zz1 $rho_mid1zz1 $rho_bot1zz1 $rho_top2zz1 $rho_mid2zz1 $rho_bot2zz1 $rho_top1yy1 $rho_mid1yy1 $rho_bot1yy1 $rho_top2yy1 $rho_mid2yy1 $rho_bot2yy1 $pfile_columns $pflag2; 
rcBC_nonDuct $STc 553 $GTcol1 143 153 $fyL $fyV $Es $fc $Ec 0.300 0.300 0.180  $cv  $dbL $dbV  182.4   [expr 0.5*$H]  $rho_shr1 $rho_top1zz1 $rho_mid1zz1 $rho_bot1zz1 $rho_top2zz1 $rho_mid2zz1 $rho_bot2zz1 $rho_top1yy1 $rho_mid1yy1 $rho_bot1yy1 $rho_top2yy1 $rho_mid2yy1 $rho_bot2yy1 $pfile_columns $pflag2; 
rcBC_nonDuct $STc 554 $GTcol1 144 154 $fyL $fyV $Es $fc $Ec 0.300 0.300 0.180  $cv  $dbL $dbV  91.20   [expr 0.5*$H]  $rho_shr1 $rho_top1zz1 $rho_mid1zz1 $rho_bot1zz1 $rho_top2zz1 $rho_mid2zz1 $rho_bot2zz1 $rho_top1yy1 $rho_mid1yy1 $rho_bot1yy1 $rho_top2yy1 $rho_mid2yy1 $rho_bot2yy1 $pfile_columns $pflag2; 

rcBC_nonDuct $STc 561 $GTcol1 151 161 $fyL $fyV $Es $fc $Ec 0.300 0.300 0.180  $cv  $dbL $dbV  35.75   [expr 0.5*$H]  $rho_shr1 $rho_top1zz1 $rho_mid1zz1 $rho_bot1zz1 $rho_top2zz1 $rho_mid2zz1 $rho_bot2zz1 $rho_top1yy1 $rho_mid1yy1 $rho_bot1yy1 $rho_top2yy1 $rho_mid2yy1 $rho_bot2yy1 $pfile_columns $pflag2; 
rcBC_nonDuct $STc 562 $GTcol1 152 162 $fyL $fyV $Es $fc $Ec 0.300 0.300 0.180  $cv  $dbL $dbV  71.50   [expr 0.5*$H]  $rho_shr1 $rho_top1zz1 $rho_mid1zz1 $rho_bot1zz1 $rho_top2zz1 $rho_mid2zz1 $rho_bot2zz1 $rho_top1yy1 $rho_mid1yy1 $rho_bot1yy1 $rho_top2yy1 $rho_mid2yy1 $rho_bot2yy1 $pfile_columns $pflag2; 
rcBC_nonDuct $STc 563 $GTcol1 153 163 $fyL $fyV $Es $fc $Ec 0.300 0.300 0.180  $cv  $dbL $dbV  71.50   [expr 0.5*$H]  $rho_shr1 $rho_top1zz1 $rho_mid1zz1 $rho_bot1zz1 $rho_top2zz1 $rho_mid2zz1 $rho_bot2zz1 $rho_top1yy1 $rho_mid1yy1 $rho_bot1yy1 $rho_top2yy1 $rho_mid2yy1 $rho_bot2yy1 $pfile_columns $pflag2; 
rcBC_nonDuct $STc 564 $GTcol1 154 164 $fyL $fyV $Es $fc $Ec 0.300 0.300 0.180  $cv  $dbL $dbV  35.75   [expr 0.5*$H]  $rho_shr1 $rho_top1zz1 $rho_mid1zz1 $rho_bot1zz1 $rho_top2zz1 $rho_mid2zz1 $rho_bot2zz1 $rho_top1yy1 $rho_mid1yy1 $rho_bot1yy1 $rho_top2yy1 $rho_mid2yy1 $rho_bot2yy1 $pfile_columns $pflag2; 


#Beam element
rcBC_nonDuct $STb  721 $GTbmx1 621 622 $fyL $fyV $Es $fc $Ec 0.300 0.400 0.180  $cv  $dbL $dbV  0.00  [expr 0.5*$Lcamp1]  $rho_shr5 $rho_top1zz5 $rho_mid1zz5 $rho_bot1zz5 $rho_top2zz5 $rho_mid2zz5 $rho_bot2zz5 $rho_top1yy5 $rho_mid1yy5 $rho_bot1yy5 $rho_top2yy5 $rho_mid2yy5 $rho_bot2yy5 $pfile_beam $pflag2; 
rcBC_nonDuct $STb  722 $GTbmx1 622 623 $fyL $fyV $Es $fc $Ec 0.300 0.400 0.180  $cv  $dbL $dbV  0.00  [expr 0.5*$Lcamp2]  $rho_shr6 $rho_top1zz6 $rho_mid1zz6 $rho_bot1zz6 $rho_top2zz6 $rho_mid2zz6 $rho_bot2zz6 $rho_top1yy6 $rho_mid1yy6 $rho_bot1yy6 $rho_top2yy6 $rho_mid2yy6 $rho_bot2yy6 $pfile_beam $pflag2;
rcBC_nonDuct $STb  723 $GTbmx1 623 624 $fyL $fyV $Es $fc $Ec 0.300 0.400 0.180  $cv  $dbL $dbV  0.00  [expr 0.5*$Lcamp2]  $rho_shr7 $rho_top1zz7 $rho_mid1zz7 $rho_bot1zz7 $rho_top2zz7 $rho_mid2zz7 $rho_bot2zz7 $rho_top1yy7 $rho_mid1yy7 $rho_bot1yy7 $rho_top2yy7 $rho_mid2yy7 $rho_bot2yy7 $pfile_beam $pflag2; 

rcBC_nonDuct $STb  731 $GTbmx1 631 632 $fyL $fyV $Es $fc $Ec 0.300 0.400 0.180  $cv  $dbL $dbV  0.00  [expr 0.5*$Lcamp1]  $rho_shr5 $rho_top1zz5 $rho_mid1zz5 $rho_bot1zz5 $rho_top2zz5 $rho_mid2zz5 $rho_bot2zz5 $rho_top1yy5 $rho_mid1yy5 $rho_bot1yy5 $rho_top2yy5 $rho_mid2yy5 $rho_bot2yy5 $pfile_beam $pflag2; 
rcBC_nonDuct $STb  732 $GTbmx1 632 633 $fyL $fyV $Es $fc $Ec 0.300 0.400 0.180  $cv  $dbL $dbV  0.00  [expr 0.5*$Lcamp2]  $rho_shr6 $rho_top1zz6 $rho_mid1zz6 $rho_bot1zz6 $rho_top2zz6 $rho_mid2zz6 $rho_bot2zz6 $rho_top1yy6 $rho_mid1yy6 $rho_bot1yy6 $rho_top2yy6 $rho_mid2yy6 $rho_bot2yy6 $pfile_beam $pflag2;
rcBC_nonDuct $STb  733 $GTbmx1 633 634 $fyL $fyV $Es $fc $Ec 0.300 0.400 0.180  $cv  $dbL $dbV  0.00  [expr 0.5*$Lcamp2]  $rho_shr7 $rho_top1zz7 $rho_mid1zz7 $rho_bot1zz7 $rho_top2zz7 $rho_mid2zz7 $rho_bot2zz7 $rho_top1yy7 $rho_mid1yy7 $rho_bot1yy7 $rho_top2yy7 $rho_mid2yy7 $rho_bot2yy7 $pfile_beam $pflag2; 

rcBC_nonDuct $STb  741 $GTbmx1 641 642 $fyL $fyV $Es $fc $Ec 0.300 0.400 0.180  $cv  $dbL $dbV  0.00  [expr 0.5*$Lcamp1]  $rho_shr5 $rho_top1zz5 $rho_mid1zz5 $rho_bot1zz5 $rho_top2zz5 $rho_mid2zz5 $rho_bot2zz5 $rho_top1yy5 $rho_mid1yy5 $rho_bot1yy5 $rho_top2yy5 $rho_mid2yy5 $rho_bot2yy5 $pfile_beam $pflag2; 
rcBC_nonDuct $STb  742 $GTbmx1 642 643 $fyL $fyV $Es $fc $Ec 0.300 0.400 0.180  $cv  $dbL $dbV  0.00  [expr 0.5*$Lcamp2]  $rho_shr6 $rho_top1zz6 $rho_mid1zz6 $rho_bot1zz6 $rho_top2zz6 $rho_mid2zz6 $rho_bot2zz6 $rho_top1yy6 $rho_mid1yy6 $rho_bot1yy6 $rho_top2yy6 $rho_mid2yy6 $rho_bot2yy6 $pfile_beam $pflag2;
rcBC_nonDuct $STb  743 $GTbmx1 643 644 $fyL $fyV $Es $fc $Ec 0.300 0.400 0.180  $cv  $dbL $dbV  0.00  [expr 0.5*$Lcamp2]  $rho_shr7 $rho_top1zz7 $rho_mid1zz7 $rho_bot1zz7 $rho_top2zz7 $rho_mid2zz7 $rho_bot2zz7 $rho_top1yy7 $rho_mid1yy7 $rho_bot1yy7 $rho_top2yy7 $rho_mid2yy7 $rho_bot2yy7 $pfile_beam $pflag2; 

rcBC_nonDuct $STb  751 $GTbmx1 651 652 $fyL $fyV $Es $fc $Ec 0.300 0.400 0.180  $cv  $dbL $dbV  0.00  [expr 0.5*$Lcamp1]  $rho_shr5 $rho_top1zz5 $rho_mid1zz5 $rho_bot1zz5 $rho_top2zz5 $rho_mid2zz5 $rho_bot2zz5 $rho_top1yy5 $rho_mid1yy5 $rho_bot1yy5 $rho_top2yy5 $rho_mid2yy5 $rho_bot2yy5 $pfile_beam $pflag2; 
rcBC_nonDuct $STb  752 $GTbmx1 652 653 $fyL $fyV $Es $fc $Ec 0.300 0.400 0.180  $cv  $dbL $dbV  0.00  [expr 0.5*$Lcamp2]  $rho_shr6 $rho_top1zz6 $rho_mid1zz6 $rho_bot1zz6 $rho_top2zz6 $rho_mid2zz6 $rho_bot2zz6 $rho_top1yy6 $rho_mid1yy6 $rho_bot1yy6 $rho_top2yy6 $rho_mid2yy6 $rho_bot2yy6 $pfile_beam $pflag2;
rcBC_nonDuct $STb  753 $GTbmx1 653 654 $fyL $fyV $Es $fc $Ec 0.300 0.400 0.180  $cv  $dbL $dbV  0.00  [expr 0.5*$Lcamp2]  $rho_shr7 $rho_top1zz7 $rho_mid1zz7 $rho_bot1zz7 $rho_top2zz7 $rho_mid2zz7 $rho_bot2zz7 $rho_top1yy7 $rho_mid1yy7 $rho_bot1yy7 $rho_top2yy7 $rho_mid2yy7 $rho_bot2yy7 $pfile_beam $pflag2; 

rcBC_nonDuct $STb  761 $GTbmx1 661 662 $fyL $fyV $Es $fc $Ec 0.300 0.400 0.180  $cv  $dbL $dbV  0.00  [expr 0.5*$Lcamp1]  $rho_shr3 $rho_top1zz3 $rho_mid1zz3 $rho_bot1zz3 $rho_top2zz3 $rho_mid2zz3 $rho_bot2zz3 $rho_top1yy3 $rho_mid1yy3 $rho_bot1yy3 $rho_top2yy3 $rho_mid2yy3 $rho_bot2yy3 $pfile_beam $pflag2; 
rcBC_nonDuct $STb  762 $GTbmx1 662 663 $fyL $fyV $Es $fc $Ec 0.300 0.400 0.180  $cv  $dbL $dbV  0.00  [expr 0.5*$Lcamp2]  $rho_shr3 $rho_top1zz3 $rho_mid1zz3 $rho_bot1zz3 $rho_top2zz3 $rho_mid2zz3 $rho_bot2zz3 $rho_top1yy3 $rho_mid1yy3 $rho_bot1yy3 $rho_top2yy3 $rho_mid2yy3 $rho_bot2yy3 $pfile_beam $pflag2;
rcBC_nonDuct $STb  763 $GTbmx1 663 664 $fyL $fyV $Es $fc $Ec 0.300 0.400 0.180  $cv  $dbL $dbV  0.00  [expr 0.5*$Lcamp2]  $rho_shr3 $rho_top1zz3 $rho_mid1zz3 $rho_bot1zz3 $rho_top2zz3 $rho_mid2zz3 $rho_bot2zz3 $rho_top1yy3 $rho_mid1yy3 $rho_bot1yy3 $rho_top2yy3 $rho_mid2yy3 $rho_bot2yy3 $pfile_beam $pflag2; 

close $pfile_columns
close $pfile_beam
close $pfile_joint


#set w_piano -23.29
#set w_roof  -13.85
set self_pilastri -2.16
set self_travi -2.88

# Modal Analysis
set numModes 1
for { set k 1 } { $k <= $numModes } { incr k } {
    recorder Node -file [format "modes/mode%i.out" $k] -nodeRange 1 6 -dof 1 2 3  "eigen $k"
} 
set lambda [eigen  $numModes];
set omega {}
set f {}
set T {}
set pi 3.141593
foreach lam $lambda {
	lappend omega [expr sqrt($lam)]
	lappend f [expr sqrt($lam)/(2*$pi)]
	lappend T [expr (2*$pi)/sqrt($lam)]
}
puts "Modal Analysis Completed..........."

puts [format "Period s :
Period= %.3f" $T]
set period [open $outsdir/period.txt w];
puts $period [format "%.5f" $T]
close $period
# Load 	
#set w_piano -23.29
#set w_roof  -13.85
set self_pilastri -2.16
set self_travi -2.88
#8.2875 4.8075

pattern Plain 101 Constant {
	############# ELEVATION 2 #############
	load 121  	0.0 -257.55    0.0
	load 122  	0.0 -515.10  0.0
	load 123  	0.0 -515.10   0.0
	load 124  	0.0 -257.55    0.0
	load 131  	0.0 -202.10    0.0
	load 132  	0.0 -404.20  0.0
	load 133  	0.0 -404.20   0.0
	load 134  	0.0 -202.10    0.0
	load 141  	0.0 -146.65   0.0
	load 142  	0.0 -293.30  0.0
	load 143  	0.0 -293.30   0.0
	load 144  	0.0 -146.65   0.0
	load 151  	0.0 -91.20   0.0
	load 152  	0.0 -182.40  0.0
	load 153  	0.0 -182.40   0.0
	load 154  	0.0 -91.20   0.0
	load 161  	0.0 -35.75   0.0
	load 162  	0.0 -71.50   0.0
	load 163  	0.0 -71.50    0.0
	load 164  	0.0 -35.75   0.0
	
eleLoad -ele 521 522 523 524 531 532 533 534 541 542 543 544 551 552 553 554 561 562 563 564 -type -beamUniform  0.0 $self_pilastri 0.0
}
# Apply the load
# 	constraints Transformation
constraints 	Penalty 1e14 1e14
numberer 		RCM
system UmfPack -lvalueFact 30
# system UmfPack Mumps
test EnergyIncr	1e-6 1000
algorithm KrylovNewton
set nG 500;
integrator LoadControl [expr 1/$nG]
analysis Static
analyze $nG
# maintain constant gravity loads and reset time to zero
loadConst -time 0.0
puts "Gravity Analysis Completed..........."
print ele 521 522 523 524 531 532 533 534 541 542 543 544 551 552 553 554 561 562 563 564 

puts "Model Built"


puts "Load Pattern Started";				# Text seen on interpreter
# Load Pattern Definition--------------------------------------------------------
pattern Plain 1 Linear { 
load 121 	 1.0 0.0 0.0;	
load 122 	 1.0 0.0 0.0;		
load 123 	 1.0 0.0 0.0;	
load 124 	 1.0 0.0 0.0;	
load 131 	 2.0 0.0 0.0;	
load 132 	 2.0 0.0 0.0;		
load 133 	 2.0 0.0 0.0;	
load 134 	 2.0 0.0 0.0;
load 141 	 3.0 0.0 0.0;	
load 142 	 3.0 0.0 0.0;		
load 143 	 3.0 0.0 0.0;	
load 144 	 3.0 0.0 0.0;
load 151 	 4.0 0.0 0.0;	
load 152 	 4.0 0.0 0.0;		
load 153 	 4.0 0.0 0.0;	
load 154 	 4.0 0.0 0.0;
load 161 	 5.0 0.0 0.0;	
load 162 	 5.0 0.0 0.0;		
load 163 	 5.0 0.0 0.0;	
load 164 	 5.0 0.0 0.0;
}
puts "Recorders Started";					# Text seen on interpreter
recorder Node -file ID_5_disp5_infill2.out -node 121 131 141 151 161 -dof 1 disp
# Support reactions
recorder Node -file ID_5_V5_infill2.out -node 11 12 13 14 -dof 1 reaction;
puts "Analysis Objects Started";			# Text seen on interpreter
constraints Plain;
numberer Plain;								# Nodes are assigned dof's arbitrarily
system BandGeneral;							# Un-symmetric banded system solved using Lapack Band General Solver
test NormDispIncr 1.0e-3 600 0;				# Create the convergence test
algorithm Newton;							# Create the solution algorithm
# integrator DisplacementControl $nodeTag $dofTag $dU1
integrator DisplacementControl 161 1 0.0001
analysis Static;							# Static Analysis
analyze 800000;									
puts "Done with Experimental test";		# Text seen on interpreter
wipe;

